import cv2
import numpy as np

img = cv2.imread('cat_dog.jpg')

# np.ones 生成的数组中的所有元素都被初始化为数值 1
kernel = np.ones((6, 6), np.uint8)

# 侵蚀
img = cv2.erode(img, kernel, cv2.BORDER_REFLECT)
cv2.imshow('image', img)

cv2.waitKey(0)
cv2.destroyAllWindows()